package main

import (
	"encoding/json"
	"fmt"
)

func main() {
	person := map[string]interface{}{
		"name":  "豆浆",
		"age":   "18",
		"hobby": []string{"吃", "喝", "玩", "乐"},
	}

	fmt.Println("person:", person)

	//序列化
	jsons, err := json.Marshal(person)
	if err != nil {
		fmt.Println("json marshal error:", err)
	}
	fmt.Println("json:", string(jsons))

	delete(person, "hobby")

	fmt.Println("person:", person)

	person["name"] = "不爱喝的豆浆"
	person["age"] = "19"
	person["hobby"] = []string{"吃", "玩", "乐"}
	fmt.Println("person:", person)

}
